﻿using UnityEngine;
using System.Collections;

public class EnemyCreater : MonoBehaviour
{
	public GameObject[]enemyPrefabs;

	public float creatinterval = 2f;

	// Use this for initialization
	void Start () {
		InvokeRepeating ("CreatOne", 0, creatinterval);
	
	}
	void CreatOne()
	{
		int index = Random.Range (0, enemyPrefabs.Length);
		GameObject prefab = enemyPrefabs [index];
		Vector3 pos = new Vector3 (Random.Range (-2.5f, 2.5f), 5.5f);
		Instantiate (prefab, pos, Quaternion.identity);

	}
}
